/*   1:    */ package com.rinsi.admin.role;
/*   2:    */ 
/*   3:    */ import com.rinsi.core.CoreCache;
/*   4:    */ import com.rinsi.core.service.CoreSimpleService;
/*   5:    */ import com.rinsi.util.AssertUtil;
/*   6:    */ import com.rinsi.util.MapUtil;
/*   7:    */ import java.util.List;
/*   8:    */ import java.util.Map;
/*   9:    */ import org.mybatis.spring.SqlSessionTemplate;
/*  10:    */ import org.springframework.stereotype.Service;
/*  11:    */ 
/*  12:    */ @Service
/*  13:    */ public class RoleService
/*  14:    */   extends CoreSimpleService
/*  15:    */ {
/*  16:    */   public void afterIndex(Map<String, Object> model, Map<String, Object> rMap)
/*  17:    */   {
/*  18: 23 */     Map<String, Object> params = getParams(model);
/*  19:    */     
/*  20: 25 */     Map<String, Object> config = getConfig(model);
/*  21:    */     
/*  22: 27 */     Map<String, Object> user = CoreCache.getCacheMap(MapUtil.getString(params, "UID"), "user");
/*  23:    */     
/*  24: 29 */     rMap.put("user", user);
/*  25:    */     
/*  26: 31 */     rMap.put("roles", getSqlSessionTemplate().selectList(namespace(config) + ".listRoles", user));
/*  27:    */     
/*  28: 33 */     rMap.put("sjzts", getSqlSessionTemplate().selectList("Core.getCodeList", "000001"));
/*  29:    */   }
/*  30:    */   
/*  31:    */   public void beforeInsert(Map<String, Object> model)
/*  32:    */   {
/*  33: 39 */     Map<String, Object> params = getParams(model);
/*  34:    */     
/*  35: 41 */     Map<String, Object> user = CoreCache.getCacheMap(MapUtil.getString(params, "UID"), "user");
/*  36: 43 */     if (MapUtil.getInteger(user, "USER_RIGHT").intValue() == 9) {
/*  37: 45 */       params.put("ROLE_RIGHT", Integer.valueOf(8));
/*  38:    */     } else {
/*  39: 49 */       params.put("ROLE_RIGHT", Integer.valueOf(1));
/*  40:    */     }
/*  41: 52 */     params.put("ORGAN_ID", user.get("ORGAN_ID"));
/*  42:    */   }
/*  43:    */   
/*  44:    */   public void beforeLock(Map<String, Object> model)
/*  45:    */   {
/*  46: 59 */     Map<String, Object> params = getParams(model);
/*  47:    */     
/*  48: 61 */     Map<String, Object> config = getConfig(model);
/*  49:    */     
/*  50:    */ 
/*  51: 64 */     Map<String, Object> user = (Map)getSqlSessionTemplate().selectOne(namespace(config) + ".get", params);
/*  52: 66 */     if (!AssertUtil.isStringNotEmpty(MapUtil.getString(user, "USER_PASSWORD"))) {
/*  53: 68 */       params.put("USER_PASSWORD", "123456");
/*  54:    */     }
/*  55:    */   }
/*  56:    */   
/*  57:    */   public Map<String, Object> listModules(Map<String, Object> model)
/*  58:    */   {
/*  59: 82 */     Map<String, Object> params = getParams(model);
/*  60:    */     
/*  61: 84 */     Map<String, Object> config = getConfig(model);
/*  62:    */     
/*  63: 86 */     Map<String, Object> rMap = getRMap();
/*  64:    */     try
/*  65:    */     {
/*  66: 90 */       Map<String, Object> user = CoreCache.getCacheMap(MapUtil.getString(params, "UID"), "user");
/*  67: 92 */       if (MapUtil.getInteger(user, "USER_RIGHT").intValue() == 9) {
/*  68: 94 */         params.put("FP_RIGHT", "9");
/*  69:    */       }
/*  70: 97 */       List<Map<String, Object>> datas = getSqlSessionTemplate().selectList(namespace(config) + ".listModules", params);
/*  71:    */       
/*  72: 99 */       rMap.put("datas", datas);
/*  73:    */     }
/*  74:    */     catch (Exception ex)
/*  75:    */     {
/*  76:103 */       rMap.put("success", Boolean.valueOf(false));
/*  77:    */       
/*  78:105 */       rMap.put("message", "获取系统权限出错！请稍后重试，或联系系统管理员！");
/*  79:    */       
/*  80:107 */       ex.printStackTrace();
/*  81:    */     }
/*  82:110 */     return rMap;
/*  83:    */   }
/*  84:    */   
/*  85:    */   public Map<String, Object> reModuleRight(Map<String, Object> model)
/*  86:    */   {
/*  87:122 */     Map<String, Object> params = getParams(model);
/*  88:    */     
/*  89:124 */     Map<String, Object> config = getConfig(model);
/*  90:    */     
/*  91:126 */     Map<String, Object> rMap = getRMap();
/*  92:    */     try
/*  93:    */     {
/*  94:130 */       getSqlSessionTemplate().update(namespace(config) + ".reModuleRight", params);
/*  95:    */     }
/*  96:    */     catch (Exception ex)
/*  97:    */     {
/*  98:134 */       rMap.put("success", Boolean.valueOf(false));
/*  99:    */       
/* 100:136 */       rMap.put("message", "修改系统权限出错！请稍后重试，或联系系统管理员！");
/* 101:    */       
/* 102:138 */       ex.printStackTrace();
/* 103:    */     }
/* 104:141 */     return rMap;
/* 105:    */   }
/* 106:    */   
/* 107:    */   public Map<String, Object> listFpModules(Map<String, Object> model)
/* 108:    */   {
/* 109:153 */     Map<String, Object> params = getParams(model);
/* 110:    */     
/* 111:155 */     Map<String, Object> config = getConfig(model);
/* 112:    */     
/* 113:157 */     Map<String, Object> rMap = getRMap();
/* 114:    */     try
/* 115:    */     {
/* 116:161 */       List<Map<String, Object>> datas = getSqlSessionTemplate().selectList(namespace(config) + ".listFpModules", params);
/* 117:    */       
/* 118:163 */       rMap.put("datas", datas);
/* 119:    */     }
/* 120:    */     catch (Exception ex)
/* 121:    */     {
/* 122:167 */       rMap.put("success", Boolean.valueOf(false));
/* 123:    */       
/* 124:169 */       rMap.put("message", "获取系统分配权限出错！请稍后重试，或联系系统管理员！");
/* 125:    */       
/* 126:171 */       ex.printStackTrace();
/* 127:    */     }
/* 128:174 */     return rMap;
/* 129:    */   }
/* 130:    */   
/* 131:    */   public Map<String, Object> reFpModuleRight(Map<String, Object> model)
/* 132:    */   {
/* 133:186 */     Map<String, Object> params = getParams(model);
/* 134:    */     
/* 135:188 */     Map<String, Object> config = getConfig(model);
/* 136:    */     
/* 137:190 */     Map<String, Object> rMap = getRMap();
/* 138:    */     try
/* 139:    */     {
/* 140:194 */       getSqlSessionTemplate().update(namespace(config) + ".reFpModuleRight", params);
/* 141:    */     }
/* 142:    */     catch (Exception ex)
/* 143:    */     {
/* 144:198 */       rMap.put("success", Boolean.valueOf(false));
/* 145:    */       
/* 146:200 */       rMap.put("message", "修改可分配权限出错！请稍后重试，或联系系统管理员！");
/* 147:    */       
/* 148:202 */       ex.printStackTrace();
/* 149:    */     }
/* 150:205 */     return rMap;
/* 151:    */   }
/* 152:    */ }


/* Location:           D:\Users\Desktop\shanxi\项目\sxazmis\WEB-INF\classes\
 * Qualified Name:     com.rinsi.admin.role.RoleService
 * JD-Core Version:    0.7.0.1
 */